import datetime
from django import template
from pytz import timezone
import pytz

utc = pytz.utc

register = template.Library()

def day(value, arg):
	"filters the given set of dates by day"
	return value

@register.filter
def objIndex(value, arg):
	"Use objects as keys in dictionaries"
	return value[arg]

@register.filter
def structToDate(value):
	"change a struct_time to a date object"
        return datetime.datetime(value[0], value[1], value[2], value[3], value[4], value[5], tzinfo=utc) 
